<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="Doc.css" rel="stylesheet"/>
<title>TreeGrid - Export to Excel</title>
</head>
<body>
<div class="Doc">


<h1>Export to Excel</h1>
<p>TreeGrid documentation</p>

Export of grid data to MS Excel in <b>xlsx</b> or <b>xhtml</b> format, to <b>csv</b>, or any other format.<br />

<i>For <b>IE9</b> and older IE versions it requires communication with server.</i><br /> 
Other browsers can save the exported file directly or can send it also to server.<br />
<br />
<i>The xlsx export and direct saving without server access was added in 12.1 version</i>.<br />
<br />

In TreeGrid export menu it is possible to choose which columns or rows to export and set various export options. <br />
See <a href="GlobalSettings.htm#CfgMenu">Configuration menu</a> for basic settings or <a href="GlobalSettings.htm#MenuExport">Export menu</a> for special settings.<br /><br />

Changes for client export can be done also by &lt;<a href="Media.htm#Media">Media</a>>&lt;M <a href="Media.htm#MMedia">Media</a>='<b>Export</b>' ... />&lt;Media>.<br /><br />

<h5>Export types</h5><br />
<b>Direct export</b> <i>(since 12.1)</i><br /> 
The exported data are created on client and saved as xlsx, csv or xls file directly to disk. <br />
It is fully done by TreeGrid.
<i>Not supported in IE9 and older.</i><br />

<br />
<b>Client export</b><br /> 
The exported data are created on client as xlsx, csv or xls, sent to server for validation and returned back to client.<br />
It is done by TreeGrid and needs very short server script to return the data back.<br />
Used instead of direct export in IE9 and older.<br />

<br />
<b>Server export</b><br />
To server is sent only configuration in XML or JSON and server generates the data and sends them back to client.<br />
It is done by custom server script that must be written by developers using TreeGrid.<br />
There can be used also TreeGrid.dll/so as support library to generate the exported data on server side, but it supports only old xls format.<br />
Server export is often required for server paging and server child paging to avoid loading all data to client.<br />

<!-----------------------------------------------------------------------  Basic settings  ------------------------------------------------->
<a name="Basic"></a><a name="XLS"></a>
<h2>Basic settings</h2>

Basic definition of export to MS Excel XLSX, XLS, CSV or any other custom type.
Shared by all export types (direct, client and server).<br />

<!-- ExportFormat -->
<a name="CfgExportFormat"></a>
<div class="XML">
   <u>new <b>6.0</b> chg <b>12.1</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>ExportFormat</h4> <s>["xlsx"] Saved to cookies, avoid it by &lt;Cfg ExportLap='1'/></s>
</div>
If and in which predefined format the export will be done. Case insensitive.<br />
It is also file extension to save the report by, always lowercase.<br />
<i>Since 12.1</i> the values completely changed and replaced <a href="#Export_Type">Export_Type</a>.<br />
Possible values: <b><i>empty</i></b> - no export, <b>xlsx</b> - (original binary Excel xlsx file), <b>csv</b> - comma or semicolon separated values, <b>xls</b> - (old xhtml file, <i>for compatibility</i>).<br />
It can contain also any other value for custom export into this file format.<br />

<!-- ExportName -->
<a name="CfgExportName"></a>
<div class="XML">
   <u>new <b>12.1</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>ExportName</h4> <s>["Export"] Saved to cookies, avoid it by &lt;Cfg ExportLap='1'/></s>
</div>
File name to save the export by. It is without extension, extension is set by <b>ExportFormat</b>.<br />

<!-- ExportType -->
<a name="CfgExportType"></a>
<div class="XML">
   <u>chg <b>15.0</b> <i>upd <b>16.1</b></i></u> <b>&lt;Cfg></b> <i>string[ ]</i>
   <h4>ExportType</h4> <s>["Expanded,Outline,ForceBorder,TextType,Strings"] Saved to cookies, avoid it by &lt;Cfg ExportLap='1'/></s>
</div>
The way of client export (or server export via TreeGrid.dll/so) to Excel, comma separated list of keywords, case insensitive.<br />
Many of these options can be changed in configuration menu, if set <a href="#CfgExportCols">ExportCols</a> = <b>2</b>.<br />
<i>Since 12.1 the default value changed, Indent was replaced by Outline.</i>
<table>
<tr><td style="width:90px;"><b>Filtered</b></td><td style="width:80px;">xlsx, csv, xls</td><td>export also filtered rows</td></tr>
<tr><td><b>HideFiltered</b></td><td>xlsx</td><td><i>(new 16.1)</i> export filtered rows as hidden, only if not set Filtered. <br />
<tr><td><b>Selected</b></td><td>xlsx, csv</td><td><i>(new 12.1)</i> export only selected rows, columns or cells. <br />
In xlsx, if set <a href="CellEditFormula.htm#CfgFormulaEditing">FormulaEditing</a> and not the <b>NoFormula</b> flag, the unused rows and columns are exported to xlsx too, but hidden.</i><br />
If selected some rows and some columns and selecting cells is not permitted, it exports only their intersection.
If nothing is selected, exports focused rows, columns or cells.<br />
</td></tr>
<tr><td><b>Expanded</b></td><td>xlsx, csv, xls</td><td>export all rows expanded</td></tr>
<tr><td>
<b>Hidden</b></td><td>xlsx</td><td>export all columns, including hidden (Visible='0' CanExport='1').
<i>(since 12.1)</i> export also manually hidden rows (Visible='0' Hidden='1' CanExport='1').
</td></tr>
<tr><td><b>Hide</b></td><td>xlsx</td><td>
   <i>(new 12.1, with option Hidden only)</i>
   Hidden columns (Visible='0') are exported as hidden. 
   Manually hidden rows (Visible='0' Hidden='1') are exported as hidden.<br />
</td></tr>
<tr><td><b>HideGroupCols</b></td><td>xlsx</td><td> <i>(new 16.1)</i> exports all columns hidden by grouping as hidden.<br /></td></tr>
<tr><td><b>Outline</b></td><td>xlsx, csv, xls</td><td>export tree as Excel outline, for csv adds new column with the outline as characters '#'</td></tr>
<tr><td><b>Indent</b></td><td>xlsx, csv, xls</td><td>indent levels in main column</td></tr>
<tr><td><b>Selection</b></td><td>xlsx</td><td><i>(new 15.0)</i> export selected rows, columns and cells as Excel selection. If not set, the selected rows/columns/cels are colored by background color, except if set <b>NoColor</b> flag</td></tr>
<tr><td><b>Focus</b></td><td>xlsx</td><td><i>(new 15.0)</i> export focused cell or range as Excel cursor.</tr>
<tr><td><b>FixedRows</b></td><td>xlsx</td><td><i>(new 12.1)</i> freeze (anchor) head rows. <i>Note, Excel does <u>not</u> support freezing foot rows.</i></td></tr>
<tr><td><b>FixedCols</b></td><td>xlsx</td><td><i>(new 12.1)</i> freeze (anchor) left columns. <i>Note, Excel does <u>not</u> support freezing right columns.</i></td></tr>
<tr><td><b>Empty</b></td><td>xlsx, csv, xls</td><td><i>(new 12.1)</i> export empty cells as actual cells with empty string - overflowing text of preceding cells will be hidden, but the resulting xlsx file of large grids may be larger. <i>Since 15.0</i> in csv exports empty cells as one space.</td></tr>
<tr><td><b>KeepHTML</b></td><td>xlsx, csv</td><td><i>(new 12.1)</i> places HTML tags to export, does not convert them to Excel style in xlsx or does not remove them in csv.</td></tr>
<tr><td><b>EnumKeys</b></td><td>xlsx, csv</td><td><i>(new 12.1)</i> for Enum and Radio type exports its keys, not values</td></tr>
<tr><td><b>TextType</b></td><td>xlsx</td><td><i>(new 12.1)</i> preserves Text type for number values. Otherwise it converts type of number values to number type.</td></tr>
<tr><td><b>Strings</b></td><td> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xls</td><td>store strings in file twice to preserve their type a spaces, set it if you want to export all strings as strings and not chosen by Excel.</td></tr>
<tr><td><b>Bool</b></td><td>xlsx, csv</td><td><i>(new 15.0)</i> exports Bool type and Auto boolean as TRUE / FALSE to xlsx or as <a href="#CfgCSVBool">CSVBool</a> to xls and csv.</td></tr>
<tr><td><b>Currency</b></td><td>xlsx, csv</td><td><i>(new 15.1)</i> exports actual currency instead of "$" in number currency format.</td></tr>
<tr><td><b>Language</b></td><td>xlsx</td><td><i>(new 16.1)</i> exports all date and some number formats in actual TreeGrid language and forces Excel to display this locale. <i>It does not affect decimal and thousand separators!</i></td></tr>
<tr><td><b>Unsupported</b></td><td>xlsx</td><td><i>(new 12.1)</i> exports also TreeGrid date and number formats that are not fully supported by Excel, the unsupported part is replaced by '?' (<i>since 15.0</i> defined by &lt;Lang>&lt;Format Unsupported="\?"/>&lt;/Lang>). 
   Otherwise, if not present, exports such dates as string.</td></tr>
<tr><td><b>StyleNumbers</b></td><td>xlsx</td><td><i>(new 15.0)</i> converts numbers and dates to formatted strings, if the Format contains HTML. If not present, the HTML is just removed from the Format.</td></tr>
<tr><td><b>StyleRows</b></td><td>xlsx</td><td><i>(new 15.0)</i> sets row attributes to the whole rows to style/format empty cells right to the exported table.</td></tr>
<tr><td><b>StyleCols</b></td><td>xlsx</td><td><i>(new 15.0)</i> sets column attributes also to the whole columns to style/format empty cells below the exported table.</td></tr>
<tr><td><b>NoNextCols</b></td><td>xlsx</td><td><i>(new 15.0)</i> hides all not used columns outside exported table</td></tr>
<tr><td><b>NoNextBorder</b></td><td>xlsx</td><td><i>(new 15.0)</i> hides border in all not used rows and columns outside exported table</td></tr>
<tr><td><b>NoColor</b></td><td>xlsx, &nbsp; &nbsp; &nbsp; &nbsp;xls</td><td><i>(new 14.0)</i> does not export row/col/cell Color attribute and does not color selected cells and header.</td></tr>
<tr><td><b>NoStyle</b></td><td>xlsx</td><td><i>(new 15.0)</i> does not export any row/col/cell style or border, exports only values or formulas.</td></tr>
<tr><td><b>NoSpan</b></td><td>xlsx, &nbsp; &nbsp; &nbsp; &nbsp;xls</td><td><i>(new 15.0)</i> does not export row and column span.</td></tr>
<tr><td><b>NoWrapBR</b></td><td>xlsx</td><td><i>(new 16.0)</i> does not automatically force Wrap=1 for cells containing &lt;br> in Html / EHtml type or LF in Lines type.</td></tr>
<tr><td><b>NoFormula</b></td><td>xlsx</td><td><i>(new 15.0)</i> does not export editable formulas, exports the formula results in values.</td></tr>
<tr><td><b>NoHtmlPrefix</b></td><td>xlsx</td><td><i>(new 16.1)</i> does not export HtmlPrefix and HtmlPostfix attributes, useful for import.</td></tr>
<tr><td><b>NoBOM</b></td><td>&nbsp; &nbsp; &nbsp; &nbsp;csv, xls</td><td><i>(new 15.0)</i> does not add UTF8 "EFBBBF" BOM to beginning of xls / csv.</td></tr>
<tr><td><b>Size</b></td><td>xlsx, &nbsp; &nbsp; &nbsp; &nbsp;xls</td><td><i>(new 15.0)</i> preserves default font size and column width according to the style Size.<br />
If not set, it always exports the same column widths and font size regardless on the style Size - it can export different column widths than actually displayed.</td></tr>
<tr><td><b>ForceBorder</b></td><td>xlsx</td><td><i>(new 15.0)</i> forces displaying default border between cells when set cell background color or colors header or selection</td></tr>
<tr><td><b>GMT</b></td><td>xlsx, csv, xls</td><td><i>(new 15.1)</i> to export dates in GMT regardless on GMT attributes. It was default value prior 15.1.<br /> 
   If not set, the GMT=0 dates are exported as displayed in TreeGrid (the xlsx will differ according to timezone where exported).</td></tr>
<tr><td><b>Dates</b></td><td> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xls</td><td> export dates as strings only (useful for exporting Hirji dates).</td></tr>
<tr><td><b>Rtl</b></td><td>xlsx, csv, xls</td><td><i>(new 7.1)</i> the columns will be exported in reversed order when the grid is in Rtl mode. Since <i>15.0</i> it switches <i>xlsx</i> to Rtl mode. </td></tr>

<tr><td><b>TreeGrid</b></td><td>xlsx</td><td><i>(new 16.1)</i> exports TreeGrid id (TGid), grouping setting (TGGroup) and rows excluded from import (TGIgnoreRows) to the sheet names.<br />Used for exporting xlsx that can be imported by <a href="Import.htm#CfgImportRows">ImportRows</a>. </td></tr>
<tr><td><b>ColNames</b></td><td>xlsx</td><td><i>(new 16.1)</i> exports all column names (TGCol_xxx) to the sheet names.<br />Used for exporting xlsx that can be imported by <a href="Import.htm#CfgImportRows">ImportRows</a>.</td></tr>
<tr><td><b>Defs</b></td><td>xlsx</td><td><i>(new 16.1)</i> exports names of default rows in last hidden column named in sheet names as (TGCol__Def).<br />Used for exporting xlsx that can be imported by <a href="Import.htm#CfgImportRows">ImportRows</a>.</td></tr>
<tr><td><b>GroupRows</b></td><td>xlsx</td><td><i>(new 16.1)</i> exports all group rows in TGIgnoreGroupRows sheet name.<br />Used for exporting xlsx with complex grouping (not all rows have the same grouping level) that can be imported by <a href="Import.htm#CfgImportRows">ImportRows</a>.</td></tr>
<tr><td><b>RangeComment</b></td><td>xlsx</td><td><i>(new 16.1)</i> exports all Date and number Range values (with more items) in raw English format to the cell comment.<br />Used also for exporting xlsx that can be imported by <a href="Import.htm#CfgImportRows">ImportRows</a>.</td></tr>
<tr><td><b>FormatComment</b></td><td>xlsx</td><td><i>(new 16.1)</i> exports all Date and number values in formats not available in Excel in raw English format to the cell comment.<br />Used also for exporting xlsx that can be imported by <a href="Import.htm#CfgImportRows">ImportRows</a>.</td></tr>
<tr><td><b>TipComment</b></td><td>xlsx</td><td><i>(new 16.1)</i> exports all cell Tip attribute values to the cell comment. It does not read the Tip from default cell, row or column.</td></tr>


</table>


<!-- ExportCols -->
<a name="CfgExportCols"></a>
<div class="XML">
   <u>new <b>6.0</b> <i>upd <b>15.1</b></i></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportCols</h4> <s>[2]</s>
</div>
If and which menu will be shown before doing export.<br />
<b>0</b> - no menu<br />
<b>1</b> - menu with columns and rows to select which columns will be exported. Only columns and rows with <tt><a href="#CCanExport">CanExport</a>='1'</tt> are listed.<br />
<b>2</b> - <i>(new 6.7)</i> menu with columns, rows and also with all options for export<br />
<b>3</b> - <i>(new 15.1)</i> shows the menu also if the grid shows imported xlsx<br />
See <a href="GlobalSettings.htm#CfgMenu">Configuration menu</a> for basic settings or <a href="GlobalSettings.htm#MenuExport">Export menu</a> for special settings.<br />

<!-- ExportLoad -->
<a name="CfgExportLoad"></a>
<div class="XML">
   <u>new <b>12.1</b> <i>upd <b>13.1</b></i></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportLoad</h4> <s>[0]</s>
</div>
<i>For direct or client export.</i> Set to <b>1</b> in server paging or child paging to download all rows to be exported.<br />
<i>Since 13.1</i> if set to <b>2</b> it downloads all rows also if <a href="#CfgExportType">ExportType</a> contains flag Selected - useful if row selection is saved on server.<br />
Be careful permitting this option, it will download all pages and optionally child pages, when used <a href="#CfgExportType">ExportType</a> = <b>Expanded</b>.<br />

<!-- ExportTip -->
<a name="CfgExportTip"></a>
<div class="XML">
   <u>new <b>16.1</b></u> <b>&lt;Cfg></b> <i>string[]</i>
   <h4>ExportTip</h4> <s>["10,5,200,70,0,infoBackground"]</s>
</div>
Settings for exported comments in xlsx, comma separated attributes "left,top,width,height,show,background,border".<br />
<b>left</b>, <b>top</b> is position of the comment relative to the right top edge of the cell, cannot be negative.<br />
<b>width</b>, <b>height</b> is size of the comment window.<br />
<b>show</b> is 0 to hide the comments on start, 1 to show all comments on start.<br />
<b>background</b> is background color of the comment window, can be any HTML color.<br />
<b>border</b> is border color of the comment window, can be any HTML color or 'none'.<br />
<i>Tip as comment is exported only if set flag "TipComment" in <a href="#CfgExportType">ExportType</a>.</i><br />

<!-- ExportGrids -->
<a name="CfgExportGrids"></a>
<div class="XML">
   <u>new <b>16.1</b></u> <b>&lt;Cfg></b> <i>string[]</i>
   <h4>ExportGrids</h4> <s></s>
</div>
Comma separated ids of grids to export.<br />
If set and exporting to xlsx, exports all given grids to one xlsx on separate sheets.<br />
The main grid id must be listed too to be exported.<br />
Users in export menu can choose options, columns and rows only for the main exported grid, other grids are exported with default options.<br />

<!-- ExportSheet -->
<a name="CfgExportSheet"></a>
<div class="XML">
   <u>new <b>16.1</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>ExportSheet</h4> <s>[<i>DefaultSheet or id</i>]</s>
</div>
Sheet name in xlsx where this grid will be saved, useful when saving more grids to one xlsx.<br />
If not set, the DefaultSheet from Lang Alert will be used if exporting the only grid or grid id will be used if exporting more grids by <a href="#CfgExportGrids">ExportGrids</a>.<br />

<!-- CanExport -->
<a name="CCanExport"></a>
<div class="XML">
   <u><i>upd <b>16.1</b></i></u> <b>&lt;C></b> <i>int</i>
   <h4>CanExport</h4> <s>[1/0]</s>
</div>
If the column will be exported. 
   <b>0</b> - no, 
   <b>1</b> - yes, if chosen in menu or is visible, 
   <b>2</b> - not used (now works as 3),  
   <b>3</b> - always,
   <b>4</b> - <i>(new 15.0)</i> always even if not selected and exporting selected only, 
   <b>5</b> - <i>(new 16.1)</i> always but hidden (in xlsx) or like <b>4</b> in csv/xls.<br />
   <b>6</b> - <i>(new 16.1)</i> always and visible (in xlsx) or like <b>4</b> in csv/xls.<br />
By default Panel has <b>0</b> and other columns <b>1</b>.<br />
More changes for client export can be done also by &lt;<a href="Media.htm#Media">Media</a>>&lt;M <a href="Media.htm#MMedia">Media</a>='<b>Export</b>' ... />&lt;Media>.<br />

<!-- CanExport -->
<a name="ICanExport"></a>
<div class="XML">
   <u><i>upd <b>16.1</b></i></u> <b>&lt;I></b> <i>int</i>
   <h4>CanExport</h4> <s>[1]</s>
</div>
If row will be exported to Excel.<br /> 
   <b>0</b> - neither row, nor its children, 
   <b>1</b> - yes, if chosen in menu or is visible, 
   <b>2</b> - <i>(new 11.0)</i> only its children, 
   <b>3</b> <i>(new 12.1)</i> always, 
   <b>4</b> - <i>(new 15.0)</i> always even if not selected and exporting selected only,
   <b>5</b> - <i>(new 16.1)</i> always but hidden (in xlsx) or like <b>4</b> in csv/xls.<br />
   <b>6</b> - <i>(new 16.1)</i> always and visible (in xlsx) or like <b>4</b> in csv/xls.<br />
<i>Space rows are <u>never</u> exported.</i><br />

<!-- MenuCheck -->
<a name="CMenuCheck"></a>
<div class="XML">
   <u>new <b>14.1</b></u> <b>&lt;C> &lt;I></b> <i>bool</i>
   <h4>MenuCheck</h4> <s></s>
</div>
If the column or row is checked in the print and export menu. If not set, the item is checked according to its Visible and CanPrint/CanExport setting.<br />

<!-- ExportPrefix -->
<a name="CfgExportPrefix"></a>
<div class="XML">
   <u>chg <b>15.0</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>ExportPrefix</h4> <s></s>
</div>
<i>Since 15.0</i> for <b>xlsx</b> and <b>csv</b> it adds new first row with this text in its first cell. It is ignored if set <b>FormulaEditing</b>.<br />
For <b>xls</b> it is HTML code added into Excel report between Excel header and TreeGrid table.<br />

<!-- ExportPostfix -->
<a name="CfgExportPostfix"></a>
<div class="XML">
   <u>chg <b>15.0</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>ExportPostfix</h4> <s></s>
</div>
<i>Since 15.0</i> for <b>xlsx</b> and <b>csv</b> it adds new last row with this text in its first cell.<br />
For <b>xls</b> it is HTML code added into Excel report between exported TreeGrid table and enclosing &lt;/body> tag<br />

<!-- ExportHtml -->
<a name="CellExportHtml"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;cell></b> <i>string</i>
   <h4>ExportHtml</h4> <s></s>
</div>
Raw cell value used for export to Excel exported as EHtml type without Format.<br />

<!-- ExportValue -->
<a name="CellExportValue"></a>
<div class="XML">
   <u></u> <b>&lt;cell></b> <i>string</i>
   <h4>ExportValue</h4> <s></s>
</div>
Cell value used for export to Excel. It uses the same Type as Format as the cell value.<br />

<!-- OnGetExportValue -->
<a name="OnGetExportValue"></a>
<div class="API">
   <u><i>upd <b>15.0</b></i></u> <b>API event</b> <i>string</i>
   <h4>OnGetExportValue</h4> <s>(<i>TGrid</i> <b>grid</b>, <i>TRow</i> <b>row</b>, <i>string</i> <b>col</b>, <i>string</i> <b>str</b>, <i>string</i> <b>format</b>)</s>
</div>
Called to get value for export. <b>format</b> <i>(new 15.0)</i> is the exported format, "xlsx", "xls" or "csv".<br />
<br />
If called from <b>xlsx</b> export, the <b>format</b> is set to "xlsx" and the <b>str</b> is html value to be exported as the cell value in xlsx. Return new <b>str</b> value for export or null to export original <b>str</b>.<br />
<br />
If called from <b>csv</b> export, the <b>format</b> is set to "csv" and the <b>str</b> is html value that will be exported to csv, without the html tags. Return new value for export or null to export original <b>str</b>.<br />
<br />
If called from <b>xls</b> export, the <b>format</b> is set to "xls" and the <b>str</b> is html tag ending character ('>'), so to return just string return str+your_value and to return formatted number return your_format+str+your_value.<br />
For example: <tt>Grids.OnGetExportValue = function(G,row,col,str,format)&#123; return " style='mso-number-format:\"$ 0.00\";'"+str+Get(row,col); }</tt><br />

<!-- ExportFormat -->
<a name="CExportFormat"></a>
<div class="XML">
   <u>chg <b>15.0</b></u> <b>&lt;C> &lt;I> &lt;cell></b> <i>string</i>
   <h4>ExportFormat</h4> <s></s>
</div>
TreeGrid date time or number format to be used instead of the cell <b>Format</b> for export to Excel.<br />
See <a href="TypeNumber.htm#CExportFormat">ExportFormat</a> for number type or <a href="TypeDate.htm#CExportFormat">ExportFormat</a> for date type.<br />
<i>From 12.1 to 14.1 it was <u>not</u> used for <b>old xls</b> export except for <a href="#ExportType">ExportType</a>="Dates", it used <a href="#CXlsFormat">XlsFormat</a> instead.</i><br />
<i>Since 15.0 it is used for all exports, including xls and it is also read from row</i>.<br />

<!-- XlsFormat -->
<a name="CXlsFormat"></a>
<div class="XML">
   <u>new <b>12.1</b> chg <b>15.0</b></u> <b>&lt;C> &lt;I> &lt;cell></b> <i>string</i>
   <h4>XlsFormat</h4> <s></s>
</div>
<i><b>xlsx</b> and <b>old xls</b> only</i>.<br />
Excel date time or number format to be used instead of the cell <b>Format</b> and <a href="#CExportFormat">ExportFormat</a> for export to Excel.<br />
It is exact MS Excel format string passed directly to xlsx format or to xls CSS attribute <b>mso-number-format</b>.<br />
<i>Since 15.0 it is used also for xlsx and it is also read from row.</i><br />

<!-- ExportEmptyDecimals -->
<a name="CfgExportEmptyDecimals"></a>
<div class="XML">
   <u>chg <b>15.0</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>ExportEmptyDecimals</h4> <s>[1]</s>
</div>
<i>Excel cannot easily display numbers with and without decimals by one format.</i><br />
How to export formats containing ".#" to show optional decimals.<br />
<b>0</b> - export formats without change, the integer numbers will end by dot (or comma in some languages).<br />
<b>1</b> - change format in cells with integer numbers to be without decimals - if is edited such cell in Excel, it will never show the decimals until the format is manually changed.<br />
<b>2</b> - replace the number format by "General" and round the exported numbers to desired decimals count.<br />

<!-- ExportRound -->
<a name="CfgExportRound"></a>
<div class="XML">
   <u></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportRound</h4> <s></s>
</div>
If set, the Float number will be rounded to this count of decimal digits.<br />

<!-- ExportBool -->
<a name="CfgExportBool"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Cfg></b> <i>string[*]</i>
   <h4>ExportBool</h4> <s>["||X|?"]</s>
</div>
<i><b>csv</b> and <b>old xls</b> only</i>. First character separated list of three values for export in Bool type as "|0|1|empty". Used only if <a href="#CfgExportType">ExportType</a> contains "Bool" flag.<br />

<!-- ExportFilters -->
<a name="FormatExportFilters"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Format></b> <i>string[]</i>
   <h4>ExportFilters</h4> <s>[...]</s>
</div>
Comma separated list of strings that will be exported instead of TreeGrid filter operator images.<br />
Default value is ",= ,&#x2260; ,&lt; ,&#x2264; ,> ,&#x2265; ,|* ,|- ,*| ,-| ,*|* ,-|- "

<!-- ExportFiltersHtml -->
<a name="FormatExportFiltersHtml"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Format></b> <i>string</i>
   <h4>ExportFiltersHtml</h4> <s>[...]</s>
</div>
<i><b>xlsx</b> and <b>old xls</b> only.</i> Html code to use when exporting the TreeGrid filter operator.<br />
Can contain simple HTML code that can be exported to xlsx cell like &lt;span style='color:...;font-size:...;font-weight:...;font-style:...;'>%1&lt;/span>.<br />
Should contain <b>%1</b> string to be replaced by actual operator string chosen from <a href="#CfgExportFilters">ExportFilters.</a><br />
Default value is "&lt;span style='color:red;'>%1&lt;/span>".<br />

<!-- ExcelLang -->
<a name="FormatExcelLang"></a>
<div class="XML">
   <u>new <b>16.1</b></u> <b>&lt;Format></b> <i>string</i>
   <h4>ExcelLang</h4> <s>["0409"]</s>
</div>
Excel hexadecimal language code, 0409 is US English.<br />
Used when exporting date formats to xlsx with <a href="#ExportType">ExportType</a> containing <b>Language</b> flag.<br />

<!-----------------------------------------------------------------------  Style  ------------------------------------------------->
<a name="Style"></a>
<h2>Styling export</h2>
Global and special styles for <b>xlsx</b> and <b>xls</b> export.<br />

<!-- ExportStyle -->
<a name="CExportStyle"></a>
<div class="XML">
   <u>new <b>7.0</b></u> <b>&lt;C> &lt;cell></b> <i>string</i>
   <h4>ExportStyle</h4> <s></s>
</div>
The CSS style added to the cell when exported.<br />
For example to align the cell vertically to top, set <tt>ExportStyle='vertical-align:top'</tt>.<br /><br />

It can be used also to format the number or date value in Excel, e.g. <tt>ExportStyle='mso-number-format:"$ 0.00";'</tt> or <tt>ExportStyle='mso-number-format:"d.M.yyyy HH:mm";'</tt><br />
The Excel CSS attribute <b>mso-number-format</b> settings are similar to TreeGrid number and date formats.<br />
<br />
<i>In xlsx</i> the permitted CSS attributes are exactly: mso-number-format, color, background-color, text-align, vertical-align, white-space, 
font-weight, font-style, font-variant, text-decoration, text-shadow, font-size, font-family, border, border-left, border-right, border-top, border-bottom.

<!-- ExportOptions -->
<a name="CfgExportOptions"></a>
<div class="XML">
   <u>new <b>12.1</b> chg <b>15.0</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>ExportOptions</h4> <s></s>
</div>
Colors and borders of exported cells.<br />
<table>
<tr><td><b>HeaderColor</b></th><td class="def">"#F5F5F5"</td><td>Color of header rows</td></tr>
<tr><td><b>HeadColor</b></th><td class="def">""</td><td><i>(new 15.0)</i> Color of head rows</td></tr>
<tr><td><b>FootColor</b></th><td class="def">""</td><td><i>(new 15.0)</i> Color of foot rows</td></tr>
<tr><td><b>LeftColor</b></th><td class="def">""</td><td><i>(new 15.0)</i> Color of left columns</td></tr>
<tr><td><b>RightColor</b></th><td class="def">""</td><td><i>(new 15.0)</i> Color of right columns</td></tr>
<tr><td><b>SelectedRowsColor</b></th><td class="def">"#FFFFA6"</td><td>Color of selected rows</td></tr>
<tr><td><b>SelectedColsColor</b></th><td class="def">"#FFFFA6"</td><td>Color of selected columns</td></tr>
<tr><td><b>SelectedCellsColor</b></th><td class="def">"#F0F0A0"</td><td>Color of selected cells</td></tr>
<tr><td><b>AddedColor</b></th><td class="def">"#D7FFD7"</td><td><i>(new 15.0)</i> Color of added rows</td></tr>
<tr><td><b>DeletedColor</b></th><td class="def">"#FFE5E4"</td><td><i>(new 15.0)</i> Color of deleted rows</td></tr>
<tr><td><b>MovedColor</b></th><td class="def">"#DAF3F2"</td><td><i>(new 15.0)</i> Color of moved rows</td></tr>
<tr><td><b>ChangedColor</b></th><td class="def">"#EBEBFF"</td><td><i>(new 15.0)</i> Color of rows witch changed cells</td></tr>
<tr><td><b>ChangedCellColor</b></th><td class="def">"#DADAEE"</td><td><i>(new 15.0)</i> Color of changed cells</td></tr>
<tr><td><b>AlternateColor</b></th><td class="def">"#FAFAFA"</td><td><i>(new 15.0)</i> Alternate color for <a href="#CfgExportAlternate">ExportAlternate</a></td></tr>
<tr><td><b>LinkColor</b></th><td class="def">"#0563C1"</td><td><i>(new 15.0)</i> Text color of cells with hyperlink</td></tr>
<tr><td><strike>DefaultTextShadowColor</strike></th><td class="def"></td><td><i>Deleted 15.0</i>. Replaced by <a href="#CfgExportTextShadow">ExportTextShadow</a>. Since 15.0 the TextShadow is exported as text color, not pattern.</td></tr>
<tr><td><strike>DefaultTextShadowPattern</strike></th><td class="def"></td><td><i>Deleted 15.0</i>. Replaced by <a href="#CfgExportTextShadow">ExportTextShadow</a>. Since 15.0 the TextShadow is exported as text color, not pattern.</td></tr>
<tr><td><b>TableBorder</b></th><td class="def">"1,black"</td><td>Defines border around the table.  Set it as "width,color". <i>Since 15.0 it does <b>not</b> define border between sections (head, foot, left and right columns).</i></td></tr>
<tr><td><b>HeaderBorder</b></th><td class="def">"1,gray"</td><td><i>Since 15.0</i> defines bottom border of the last Head row in Head section</td></tr>
<tr><td><b>HeadBorder</b></th><td class="def">"1,gray"</td><td><i>Since 15.0</i> defines bottom border of head section</td></tr>
<tr><td><b>FootBorder</b></th><td class="def">"1,gray"</td><td><i>Since 15.0</i> defines top border of foot section</td></tr>
<tr><td><b>LeftBorder</b></th><td class="def">"1,gray"</td><td><i>Since 15.0</i> defines right border of the left columns section</td></tr>
<tr><td><b>RightBorder</b></th><td class="def">"1,gray"</td><td><i>Since 15.0</i> defines left border of the right columns section</td></tr>
<tr><td><b>HeaderStyle</b></th><td class="def">"bold"</td><td><i>Since 15.0</i> defines style of the header text, can contain comma separated flags "bold" and "italic"</td></tr>
</table>
For example: <tt>ExportOptions="{TableBorder:'2,gray'}"</tt>

<!-- ExportAlternate -->
<a name="CfgExportAlternate"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportAlternate</h4> <s>[0]</s>
</div>
Highlight odd or every N row by another color in the exported xlsx / xls.<br />
0 - no row, 1 - every row, 2 - every odd row, every third row, 3 - every fourth row, ...<br />
If set to empty string it uses <a herf="CellStyle.htm#CfgAlternate">Alternate</a> setting also for export.<br />

<!-- ExportFontSize -->
<a name="CfgExportFontSize"></a>
<div class="XML">
   <u>new <b>12.1</b> chg <b>15.0</b></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportFontSize</h4> <s>[15]</s>
</div>
Default Excel font size in every cell. In px, not in pt.
<i>Since 15.0</i> default value changed to 15.<br />

<!-- ExportFontFace -->
<a name="CfgExportFontFace"></a>
<div class="XML">
   <u>new <b>12.1</b></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportFontFace</h4> <s>["Calibri"]</s>
</div>
Default Excel font name in every cell.

<!-- ExportWidthRatio -->
<a name="CfgExportWidthRatio"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Cfg></b> <i>float</i>
   <h4>ExportWidthRatio</h4> <s>[1.1]</s>
</div>
The column width are multiplied by this value.<br />
Use when ExportFontSize is bigger than TreeGrid font size to resize the columns to show the whole texts like in the grid.<br />

<!-----------------------------------------------------------------------  XLSX  ------------------------------------------------->
<a name="XLSX"></a>
<h2>XLSX export</h2>
Settings specific for direct or client export to xlsx.<br />

<!-- ExportImages -->
<a name="CfgExportImages"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Cfg></b> <i>string[]</i>
   <h4>ExportImages</h4> <s>[Img,Html,Space]</s>
</div>
Which images and how to export them, comma separated list of flags, case sensitive.<br />
<table>
<tr><td style="width:90px;"><b>Img</b></td><td>exports images in <a href="CellImage.htm#CellImg">Img</a> attribute and in <a href="TypeHtml.htm#TImg">Img</a> type.</td></tr>
<tr><td><b>Html</b></td><td>exports images in &lt;img> tags in EHtml and Auto types.</td></tr>
<tr><td><b>Other</b></td><td>exports images in &lt;img> tags in Html and Select types, HtmlPrefix, HtmlPostfix and Format.</td></tr>
<tr><td><b>Icon</b></td><td>exports images in Icon type.</td></tr>
<tr><td><b>Side</b></td><td>exports images in side Icon.</td></tr>
<tr><td><b>Panel</b></td><td>exports images in panel and does not export button names.</td></tr>
<tr><td><b>Button</b></td><td>exports images in side Button.</td></tr>
<tr><td><b>Bool</b></td><td>exports custom images in Bool type set in BoolIcon.</td></tr>
<tr><td><b>Space</b></td><td>Replaces the &lt;img> tags in Html and Auto type by spaces, otherwise the text is shifted.</td></tr>
<tr><td><b>Indent</b></td><td>Indents the cell value when exported with side Icon or Button.</td></tr>
<tr><td><b>Resize</b></td><td>Attaches the images to two cells (top left and bottom right) and permits resizing the image between the cells.<br />
Requires synchronized row heights between grid and xlsx, usually by <a href="#CfgExportHeights">ExportHeights</a> >= <b>3</b>.<br />
</td></tr>
</table>
<i>Images set by url (not by data:) cannot be exported when run locally on file:// protocol in IE.</i><br />

<!-- ExportLinks -->
<a name="CfgExportLinks"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Cfg></b> <i>string[]</i>
   <h4>ExportLinks</h4> <s>[Link,Html,Other,Underline]</s>
</div>
Which images and how to export them, comma separated list of flags, case sensitive.<br />
<table>
<tr><td style="width:90px;"><b>Link</b></td><td>exports links in <a href="CellBasics.htm#CLink">Link</a> attribute and in <a href="TypeHtml.htm#TLink">Link</a> type.</td></tr>
<tr><td><b>Html</b></td><td>exports first &lt;a> tag in EHtml and Auto types.</td></tr>
<tr><td><b>Other</b></td><td>exports first &lt;a> tag in HtmlPrefix, HtmlPostfix and Format.</td></tr>
<tr><td><b>Underline</b></td><td>underlines all links</td></tr>
</table>

<!-- ExportTextShadow -->
<a name="CfgExportTextShadow"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>ExportTextShadow</h4> <s></s>
</div>
If set, it exports TextShadowColor as text color if the text has not defined the TextColor.<br />
It can be set to color like "red" or "#FF0000" to use this color as TextColor for TextShadow without TextShadowColor set.<br />
If not set, the TextShadow / TextShadowColor are not exported at all.

<!-- NoExportFunc -->
<a name="CfgNoExportFunc"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Cfg></b> <i>string[]</i>
   <h4>NoExportFunc</h4> <s></s>
</div>
Comma separated list of formula function names that cannot be exported to xlsx.<br />
If formula contains any of these names, it is not exported to xlsx, the cell is exported only with its values.<br />

<!-- ExportVarHeight -->
<a name="CfgExportVarHeight"></a>
<div class="DEL">
   <u>new <b>12.1</b> deleted <b>15.0</b></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportVarHeight</h4> <s>[1]</s>
</div>
Replaced by <a href="#CfgExportHeights">ExportHeights</a><br />
<b>0</b> - All rows are exported with single line height. <i>Similar to ExportHeights='<b>2</b>'.</i><br />
<b>1</b> - Calculates height of cells in columns with <a href="#CVarHeight">VarHeight</a>>=1, row height is set to the highest cell height. <i>Similar to ExportHeights='<b>3</b>'.</i><br />
<b>2</b> - Like <b>1</b> and also ignores row <a href="RowHeight.htm#IMaxHeight">MaxHeight</a> attribute to export the whole content of all multiline cells. <i>Similar to ExportHeights='<b>4</b>'.</i><br />

<!-- ExportHeights -->
<a name="CfgExportHeights"></a>
<div class="XML">
   <u>new <b>15.0</b> <i>upd <b>16.0</b></i></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportHeights</h4> <s>[1/3]</s>
</div>
If and how the row heights are exported.<br />
<b>0</b> - <b>No height</b>; all the row heights will be calculated by Excel according to the cell content. Default row height with only empty or single line cells is calculated according to the <a href="#CfgExportFontSize">ExportFontSize</a>.<br />
<b>1</b> - <b>Set height</b>; Only heights set by row <a href="#RowHeight.htm#IHeight">Height</a> attribute. Rows without <a href="#RowHeight.htm#IHeight">Height</a> set will be calculated by Excel. <br />
<b>2</b> - <b>Default height</b>; All rows will be exported with default height, set by row <a href="#RowHeight.htm#IHeight">Height</a> or <a href="#CfgExportRowHeight">ExportRowHeight</a> or <a href="RowHeight.htm#CfgMinRowHeight">MinRowHeight</a> or actual CSS style height.<br />
<b>3</b> - <b>Actual height</b>; All rows will be exported with actual height used in TreeGrid. 
<i>For not rendered rows the height is calculated, so this option can slow down export if the grid has many not rendered page or child pages.</i><br />
<b>4</b> - <b>Calculated height without MaxHeight</b>; Like <b>3</b>, but ignores <a href="RowHeight.htm#IMaxHeight">MaxHeight</a> attribute to export the whole content of multiline cells.
<i>It calculates height of all rows, so this option can slow down the export if the grid contains many rows!</i><br />
<i>Since 16.0</i> Default value is <b>3</b> for exporting Gantt charts and <b>1</b> for exporting grids.<br />

<!-- ExportRowHeight -->
<a name="CfgExportRowHeight"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportRowHeight</h4> <s>[20]</s>
</div>
Default row height for export to xlsx. If not set, default row height in actual CSS style is used.<br />

<!-- OnExportRow -->
<a name="OnExportRow"></a>
<div class="API">
   <u>new <b>15.0</b></u> <b>API event</b> <i>void</i>
   <h4>OnExportRow</h4> <s>(<i>TGrid</i> <b>grid</b>, <i>TRow</i> <b>row</b>, <i>object</i> <b>exrow</b>)</s>
</div>
Called when exporting one row to <i>xlsx</i>.<br />
<b>row</b> is the source row being exported.<br />
<b>exrow</b> is the object containing all <b>row</b> attributes and cell values and attributes that will be exported.<br />
<b>exrow</b> does not have Def attribute, it has set all its attributes directly.<br />
It is possible to modify the <b>exrow</b> to change the exported row.<br />

<!-- OnExportCell -->
<a name="OnExportCell"></a>
<div class="API">
   <u>new <b>16.1</b></u> <b>API event</b> <i>void</i>
   <h4>OnExportCell</h4> <s>(<i>TGrid</i> <b>grid</b>, <i>TRow</i> <b>row</b>, <i>string</i> <b>col</b>, <i>object</i> <b>exrow</b>, <i>string</i> <b>excol</b>)</s>
</div>
Called when exporting one cell to <i>xlsx</i>.<br />
<b>row</b>, <b>col</b> is the source cell being exported.<br />
<b>exrow</b>, <b>excol</b> is the cell that contains value and attributes that will be exported.<br />
<b>exrow</b> does not have Def attribute, it has set all its attributes directly.<br />
It is possible to modify the <b>exrow</b> to change the exported cell, like exrow[excol] = "new value" or exrow[excol+"Tip"] = "new comment".<br />

<!-- OnExportCol -->
<a name="OnExportCol"></a>
<div class="API">
   <u>new <b>15.0</b></u> <b>API event</b> <i>void</i>
   <h4>OnExportCol</h4> <s>(<i>TGrid</i> <b>grid</b>, <i>TCol</i> <b>column</b>, <i>object</i> <b>excolumn</b>)</s>
</div>
Called when exporting one column to <i>xlsx</i>.<br />
<b>column</b> is the source column object (not name) being exported.<br />
<b>excolumn</b> is the object containing all <b>column</b> attributes that will be exported.<br />
It is possible to modify the <b>excolumn</b> to change the exported column.<br />

<!-- JSZip -->
<a name="CfgJSZip"></a>
<div class="XML">
   <u>new <b>12.1</b></u> <b>&lt;Cfg></b> <i>bool</i>
   <h4>JSZip</h4> <s>[1]</s>
</div>
If third party library JSZip will be loaded and used by TreeGrid.<br />
<br />
JSZip is library for LZ compression.
It is independent on TreeGrid. It is distributed under MIT or GPLv3 license.<br />
It can be downloaded or its licensing read at <a href="https://stuk.github.io/jszip/">https://stuk.github.io/jszip/</a><br />
<br />
It is loaded by TreeGrid only for client export to <b>xlsx</b> and import of <b>xlsx</b>.<br />
To not use it at all, set &lt;Cfg JSZip='0'/>, in this case the export will produce longer uncompressed xlsx files, but xlsx import will be unavailable at all.<br />

<!-- ExportCompression -->
<a name="CfgExportCompression"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportCompression</h4> <s>[1]</s>
</div>
Zip compression level for xlsx files produced by JSZip.<br />
<b>0</b> - store (not compress), <b>1</b> - the fastest compression, ... <b>9</b> - the smallest size.<br />
Ignored when exporting imported xlsx file.<br />

<!-- ExportBase64 -->
<a name="CfgExportBase64"></a>
<div class="XML">
   <u>new <b>15.1</b></u> <b>&lt;Cfg></b> <i>bool</i>
   <h4>ExportBase64</h4> <s>[0/1]</s>
</div>
If the xlsx file is uploaded to server in base64 or in blob.<br />
Set it only if you use custom export in <a href="#OnExport">OnExport</a> API event to get appropriate data format.<br />
Default value is 1 if Export_Type is "Export" or "Save" or it is run on IE9 and older, otherwise it is 0.<br />


<!-----------------------------------------------------------------------  Gantt  ------------------------------------------------->
<a name="Gantt"></a>
<h2>Gantt export</h2>
Settings specific for exporting Gantt chart to xlsx.<br />
<br />
<strong>Exporting Gantt chart is provided only with <b>SpreadSheet</b> component!</strong><br />
<br />
Style of Gantt objects, backgrounds, border, text properties, shapes, etc. are defined in <b>&lt;GanttExport></b> root tag in <b>Defaults.xml/js</b>.<br />
The values of the GanttExport attributes are in format of xlsx OOXML, not CSS or JavaScript.

<!-- CanExport -->
<a name="CCanExport"></a>
<div class="XML">
   <u>new <b>16.0</b></u> <b>&lt;C></b> <i>bool</i>
   <h4>CanExport</h4> <s>[0]</s>
</div>
To permit exporting Gantt chart to xlsx set CanExport='1' to the Gantt column.

<!-- GanttExportOrder -->
<a name="CGanttExportOrder"></a>
<div class="XML">
   <u>new <b>16.0</b></u> <b>&lt;C></b> <i>string[]</i>
   <h4>GanttExportOrder</h4> <s></s>
</div>
Comma separated list of all Gantt objects to export, case insensitive.<br />
The order of exported the Gantt objects. The objects exported later will overlay the previous objects in the same place.<br />
<i>The <u>not</u> listed Gantt objects are never rendered.</i><br />
If not set (by default), the <a href="GanttObjects.htm#CGanttOrder">GanttOrder</a> is used.<br />
Possible keywords to use: <b>Availability</b>, <b>Constraints</b>, <b>Run</b>, <b>Main</b>, <b>Mark</b>, <b>Flags</b>, <b>Points</b>.<br />
It can contain also the next main bars keywords <b>Main1</b>, <b>Main2</b>, <b>Main3</b>, ..., <b>Main10</b>. If missing, these keywords are automatically added after Main keyword if increased <a href="GanttMain.htm#CGanttCount">GanttCount</a>.<br />
Unlike the <b>GanttOrder</b> it cannot contain <s>Chart</s> and <s>Dependency</s>. 
Chart is never exported and dependencies are exported always above other Gantt objects.<br />

<!-- GanttExportDependency -->
<a name="CGanttExportDependency"></a>
<div class="XML">
   <u>new <b>16.0</b></u> <b>&lt;C></b> <i>bool</i>
   <h4>GanttExportDependency</h4> <s>[1]</s>
</div>
If dependencies are exported to xlsx. Dependencies are always exported above other Gantt objects.

<!-- GanttExportBackground -->
<a name="CGanttExportBackground"></a>
<div class="XML">
   <u>new <b>16.0</b></u> <b>&lt;C></b> <i>int</i>
   <h4>GanttExportBackground</h4> <s>[7]</s>
</div>
If and how the Gantt background is exported to xlsx, bit array.<br />
1. bit &amp;<b>1</b> - if exports GanttLines, GanttBase and GanttFinish.<br />
2. bit &amp;<b>2</b> - if exports GanttExclude.<br />
3. bit &amp;<b>4</b> - if exports GanttBackground.<br />

<!-- GanttExportUnits -->
<a name="CGanttExportUnits"></a>
<div class="XML">
   <u>new <b>16.0</b></u> <b>&lt;C></b> <i>string</i>
   <h4>GanttExportUnits</h4> <s></s>
</div>
<a href="GanttZoom.htm#CGanttUnits">GanttUnits</a> units for export. 
For every GanttExportUnits will be created xlsx column.<br />
If not set, it is chosen as the smallest units in all GanttHeader.<br />
If it is bigger than GanttHeader units, the header is not exported correctly.

<!-- GanttExportWidth -->
<a name="CGanttExportWidth"></a>
<div class="XML">
   <u>new <b>16.0</b></u> <b>&lt;C></b> <i>int</i>
   <h4>GanttExportWidth</h4> <s></s>
</div>
<a href="GanttZoom.htm#CGanttWidth">GanttWidth</a> for exporting to xlsx.
If set <a href="GanttZoom.htm#CGanttSmoothZoom">GanttSmoothZoom</a> it is used only if it is higher than the <b>GanttWidth</b>.<br />

<!-- Images -->
<a name="GanttExportImages"></a>
<div class="XML">
   <u>new <b>16.0</b></u> <b>&lt;GanttExport></b> <i>string[*]</i>
   <h4>Images</h4> <s></s>
</div>
List of all custom images used in Gantt chart for milestones and flags. 
<i>If the custom Gantt image is not listed here, it is not exported.</i>.<br />
First character separated list as "|image_url1|width1,height1|image_url2|width2,height2|image_url3...".<br />
For example: Images="|Green.svg||Red.svg||Yellow.svg".

<!-- Span -->
<a name="GanttExportSpan"></a>
<div class="XML">
   <u>new <b>16.0</b></u> <b>&lt;GanttExport></b> <i>int</i>
   <h4>Span</h4> <s>[3]</s>
</div>
If and how the Gantt column cells will be spanned in export. Bit array.<br />
1. bit &amp;<b>1</b> - If set, all the cells will be spanned horizontally, the whole Gantt column will be one cell per row.
If not set, every <a href="CGanttExportUnits">GanttExportUnits</a> date will be one cell, the cells will have side border.<br />
2. bit &amp;<b>2</b> - If set, removes the row border between cells in Gantt column.


<!-----------------------------------------------------------------------  CSV  ------------------------------------------------->
<a name="CSV"></a>
<h2>CSV export</h2>
Settings specific for direct or client export to csv.<br />

<!-- CSVValueSeparator -->
<a name="CfgCSVValueSeparator"></a>
<div class="XML">
   <u>new <b>7.1</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>CSVValueSeparator</h4> <s>[";"]</s>
</div>
String or character that separates individual values in export to CSV<br />

<!-- CSVRowSeparator -->
<a name="CfgCSVRowSeparator"></a>
<div class="XML">
   <u>new <b>7.1</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>CSVRowSeparator</h4> <s>["&amp;#x0a;"]</s>
</div>
String or character that separates individual rows in export to CSV<br />

<!-- CSVQuote -->
<a name="CfgCSVQuote"></a>
<div class="XML">
   <u>new <b>7.1</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>CSVQuote</h4> <s>['"']</s>
</div>
Character that quotes value in export to CSV, if it contains one of the ValueSeparator, RowSeparator or Quote.<br />
The quote characters are doubled in the value.<br />

<!-- CSVLevel -->
<a name="CfgCSVLevel"></a>
<div class="XML">
   <u>new <b>7.1</b></u> <b>&lt;Cfg></b> <i>string</i>
   <h4>CSVLevel</h4> <s>["#"]</s>
</div>
String or character to show level deep, when <tt>ExportType='Outline'</tt><br />

<!-- CSVDateFormat -->
<a name="CfgCSVDateFormat"></a>
<div class="XML">
   <u>new <b>14.0</b> chg <b>15.0</b></u> <b>&lt;Cfg></b> <i>type</i>
   <h4>CSVDateFormat</h4> <s>[1]</s>
</div>
Format for all dates exported to CSV.<br />
<b>0</b> - Dates are exported as Excel numbers (count of days since 1/1/1900).<br />
<b>1</b> - Dates are exported as they are shown in grid, in display Format.<br />
<b>2</b> - Dates are exported in editable format.<br />
<i>string</i> - Dates are exported in given date format.<br />
<i>Since 15.0</i> the default value changed to <b>1</b>.<br />

<!-- CSVNumberFormat -->
<a name="CfgCSVNumberFormat"></a>
<div class="XML">
   <u>new <b>15.0</b></u> <b>&lt;Cfg></b> <i>type</i>
   <h4>CSVNumberFormat</h4> <s>[1]</s>
</div>
Format for all numbers exported to CSV.<br />
<b>0</b> - Numbers are exported as unformatted numbers with dot as decimal separator.<br />
<b>1</b> - Numbers are exported as they are shown in grid, in display Format.<br />
<b>2</b> - Numbers are exported in editable format.<br />
<i>string</i> - Numbers are exported in given number format.<br />

<!-----------------------------------------------------------------------  XLS  ------------------------------------------------->
<a name="XLS"></a>
<h2>Old XLS / XHTML export</h2>
Settings specific for direct or client export to xhtml or for export to xhtml created by TreeGrid DLL/so.<br />

<!-- ExportRows -->
<a name="CfgExportRows"></a>
<div class="DEL">
   <u>deleted <b>15.0</b></u> <b>&lt;Cfg></b> <i>int</i>
   <h4>ExportRows</h4> <s>[500]</s>
</div>
<i>Since 15.0 the xls export is also synchronous without progress bar.</i><br />

<!-----------------------------------------------------------------------  Export API  ------------------------------------------------->
<a name="API"></a>
<h2>Export API</h2>

<!-- Action Export -->
<a name="ActionsExport"></a>
<div class="ACT">
   <u></u> <b>&lt;Actions></b> <i></i>
   <h4>Export</h4>
   <s>Attached to event <b>OnClickButtonExport</b></s>
</div>
Creates report in XLSX, XLS or CSV or a request for the server report and saves it to disk or sends it to server.<br />

<!-- OnExportStart -->
<a name="OnExportStart"></a>
<div class="API">
   <u>new <b>6.0</b> <i>upd <b>7.0</b></i></u> <b>API event</b> <i>bool</i>
   <h4>OnExportStart</h4>
   <s>(<i>TGrid</i> <b>grid</b>, <i>bool</i> <b>pdf</b>)</s>
</div>
Called before the export menu is shown and the export report is generated.<br /> 
<i>(since 7.0)</i> <b>pdf</b> is true for export to PDF<br />
Return true to cancel export.<br />

<!-- OnExportInit -->
<a name="OnExportInit"></a>
<div class="API">
   <u>new <b>12.1</b></u> <b>API event</b> <i>bool</i>
   <h4>OnExportInit</h4>
   <s>(<i>TGrid</i> <b>grid</b>, <i>string[Name]</i> <b>Cols</b>, <i>string[id]</i> <b>Rows</b>, <i>object</i> <b>source</b>)</s>
</div>
Called after the options are chosen by a user in menu and before the export is generated.<br />
<b>Cols</b> is array of all columns to export, by column name. If the column is not listed, it is <u>not</u> exported.<br />
<b>Rows</b> is array of rows to export, by row id. If the row is not listed, it is exported according to its <a href="#ICanExport">CanExport</a> value.<br />
It is possible to modify these arrays.<br />
Other settings like ExportFormat or ExportType are already read from configuration and can be modified in the grid attributes.<br />
<b>source</b> is data source used, can be null for direct save or grid.Source.Export for export, or grid.Source.ExportPDF for PDF export.<br />
<i>Can be used for custom export or export to different formats.</i><br />
Return true to cancel export.<br />

<!-- OnExport -->
<a name="OnExport"></a>
<div class="API">
   <u>chg <b>12.1</b> <i>upd 15.1</i></u> <b>API event</b> <i>object</i>
   <h4>OnExport</h4>
   <s>(<i>TGrid</i> <b>grid</b>, <i>object</i> <b>data</b>, <i>int</i> <b>type</b>)</s>
</div>
Called after the export or configuration is created and before it is saved to disk or sent to server.<br /> 
<b>data</b> is the created export or configuration. It can be string or <i>(since 12.1)</i> Blob object. <i>Since 15.1</i> controlled by <a href="#CfgExportBase64">ExportBase64</a> attribute. <br /> 
<i>(since 12.1)</i> <b>type</b> is <b>data</b> type: <b>0</b> export configuration, <b>1</b> export pdf configuration, <b>2</b> direct data to save, <b>3</b> direct data to send to server, 
   <b>4</b> <i>(since 15.1)</i> direct data to send to server for save.<br />
Return true to suppress the export.<br />
Or return new or updated data to send.<br />

<!-- SaveExport -->
<a name="SaveExport"></a>
<div class="API">
   <u>new 12.1</u> <b>API method</b> <i>void</i>
   <h4>SaveExport</h4>
   <s>(<i>string</i> <b>data</b>, <i>object</i> <b>source</b> = null)</s>
</div>
Saves exported <b>data</b> to file (<b>source</b> = null) or sends it to server to <b>source</b> like grid.Source.Export or grid.Source.ExportPDF.<br />

<!-- SendExport -->
<a name="SendExport"></a>
<div class="API">
   <u>chg 12.1</u> <b>API method</b> <i>void</i>
   <h4>SendExport</h4>
   <s>(<i>string</i> <b>data</b>, <i>string</i> <b>url</b>, <i>string</i> <b>name</b>)</s>
</div>
Sends the data to server as export or configuration.<br />
<i>Since 12.1 is does <u>not</u> call <a href="#OnExport">OnExport</a>.</i><br />


<!-----------------------------------------------------------------------  Server communication  ------------------------------------------------->
<a name="Communication"></a>
<a name="Server"></a>
<h2>Communication with server</h2>

<i>By default (Export_Type="") the server communication is required only for IE9 and older browsers.</i><br />

<!-- Export_Type -->
<a name="Export_Type"></a>
<div class="XML">
   <u>chg <b>12.1</b> <i>upd <b>15.1</b></i></u> <b style="margin-left:-20px;width:115px;">&lt;treegrid,bdo></b> <i>string</i>
   <h4>Export_Type</h4> <s>[""]</s>
</div>
   If and what will be sent to server for export, case insensitive.<br />
   <br />

<b>Direct export</b> <i>(since 12.1)</i><br /><br />

<b><i>empty</i></b><br />
In <b>all browsers</b> except IE9 and below will be sent nothing to server; the generated file will be saved directly.<br />
Only in <b>IE9</b> and below will be sent to server full report in XLSX/CSV/XLS format (chosen by <a href="#CfgExportFormat">ExportFormat</a>).<br /><br />

<b>Client export</b><br /><br />

<u><b>Export</b></u><br />
To server will be sent full report in XLSX/CSV/XLS format (chosen by <a href="#CfgExportFormat">ExportFormat</a>).<br />
<i>Prior 12.1 the client export was always sent to server, using keywords "xls" or "csv"</i><br />
<br />

<u><b>Save</b></u> <i>(new 15.1)</i><br />
To server will be sent by AJAX full report in XLSX/CSV/XLS format (chosen by <a href="#CfgExportFormat">ExportFormat</a>).<br />
Nothing will be downloaded.<br />
<br />

<b>Server export</b><br /><br />

<u><b>Settings</b></u><br />
To server will be sent only configuration (sorting, grouping, filters) and columns (positions, visibility and widths) in XML.<br />
The server must generate the requested report in <b>XLSX</b>, <b>XLS</b> or <b>CSV</b> according to the settings and stored data and return it to client.<br />
See <a href="#Server">Server export</a>.<br /><br />

<u><b>Expanded</b></u><br />
Sends ids of all expanded rows in &lt;Cfg <a href="Tree.htm#CfgExpanded">Expanded</a>/> attribute, comma separated.<br /><br />

<u><b>Changes</b></u><br /> 
Used usually with Settings for server export.<br />
Sends modified rows - rows with set attribute <b>Added</b>, <b>Deleted</b>, <b>Moved</b> or <b>Changed</b> (modified values). The rows are sent in &lt;<a href="DataUpload.htm#XML">Changes</a>> tag.<br />
When set, the export does <u>not</u> save the changes to server before export, but includes them in the export request.<br /><br />

<i>This attribute supports for server export also all other settings like <b>Cookie</b> or <b>Data</b> defined for _Type, see <a href="DataUpload.htm#Upload_Type">Upload_Type</a>. Also <b>Export_Flags</b> are supported if defined, see <a href="DataUpload.htm#Upload_Flags">Upload_Flags</a>.</i><br />

<!-- Export_Url -->
<a name="Export_Url"></a>
<div class="XML">
   <u></u> <b style="margin-left:-20px;width:115px;">&lt;treegrid,bdo></b> <i>string</i>
   <h4>Export_Url</h4> <s></s>
</div>
<i>If set Export_Type="" (default value), it is required only for compatibility with IE9 and older IE browsers.</i><br />
Destination for page that generates data to export to XLSX, XLS, CSV or any other format.<br />
This server URL should return the exported data as XLSX / XLS file in HTTP content-type="application/vnd.ms-excel" or CSV as "text/csv".<br />
This communication is <u>not</u> done by AJAX, but always by hidden form, so it can be used even if no ActiveX is supported.<br />
Export cannot use Soap or Get communication.<br />
If you encounter problems with export of international (non-English) characters, add to your page, to &lt;head> section:<br />
<div class="L1"><tt>&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></tt></div><br />

In <b>client export</b> (<tt>Export_Type='&#39;</tt> or <tt>'Export&#39;</tt>) to this URL is uploaded complete exported data and the server script should just return them back.<br />
In <b>server export</b> (<tt>Export_Type='Settings'</tt> or other value) to this URL is uploaded actual grid configuration and the server script should create and return the exported data by itself.<br />

<!-- Export_Data -->
<a name="Export_Data"></a>
<div class="XML">
   <u></u> <b style="margin-left:-20px;width:115px;">&lt;treegrid,bdo></b> <i>string</i>
   <h4>Export_Data</h4> <s>["Data"]</s>
</div>
The name of form input in that will be uploaded exported data or configuration to Export_Url.<br />



<!-----------------------------------------------------------------------  Client export  ------------------------------------------------->
<a name="Client"></a>
<h2>Client export</h2>
<i>By default (Export_Type="") the server communication is required only for IE9 and older browsers.</i><br />
<br />

To server (to <b>Export_Url</b>) is sent whole prepared report that can just be returned by this page back to Excel.<br />
The uploaded data can be plain text (for xls and csv) or base64 encoded for binary xlsx.<br />
In "custom" parameter "<b>ExportFormat</b>" is sent chosen file extension "xlsx", "xls" or "csv".<br />
In "custom" parameter "<b>ExportName</b>" is sent chosen file name.<br />
Should be used only for small grids, because to server are send all data back.<br />
Cannot be used with server paging or server child paging.<br />
<i>Space rows are <u>not</u> exported.</i><br />
The server script just returns the data from <a href="DataCommunication.htm#xxx_Data">Data</a> attribute back to client with changed content type.<br />
For MS <b>Excel</b> use <tt><i><b>ContentType</b></i>="<b>application</b>/<b>vnd.ms-excel</b>"</tt> and <b><i>charset:</i> utf-8</b>.<br />
<br />

<!--------------------  Examples of server script for client export  ------------------------->
<a name=""></a>
<h3>Examples of server script for client export</h3>

Point Export_Url to simple server script that will just return the received data:<br /><br />

<b>ASP.NET</b><br />
<tt>
&lt;%@ Page Language="C#" ContentType="application/vnd.ms-excel" %><br />
&lt;% Response.AppendHeader("Content-Disposition","attachment; filename=\""+Request["ExportName"])+"."+Request["ExportFormat"]+"\"");<br />
   Response.AppendHeader("Cache-Control","max-age=1, must-revalidate");<br />
   string data = Request["Data"]; if(data==null) data = "";<br />
   if (data.IndexOf('>') >= 0 || data.IndexOf("&lt;") >= 0 || data == "") Response.Write(HttpUtility.HtmlDecode(data));<br />
   else Response.BinaryWrite(Convert.FromBase64String(data)); %><br /><br />
</tt>

<b>JSP</b><br /> 
<tt>
&lt;%@page contentType="application/vnd.ms-excel"%>&lt;%@page pageEncoding="UTF-8"%>&lt;%<br />
request.setCharacterEncoding("utf-8");<br />
response.addHeader("Content-Disposition","attachment; filename=\""+request.getParameter("ExportName")+"."+request.getParameter("ExportFormat")+"\"");<br />
response.addHeader("Cache-Control","max-age=1, must-revalidate");<br />
String XML = request.getParameter("Data"); if(XML==null) XML = "";<br />
if(XML.length()>0&&XML.charAt(0)=='&') XML = XML.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&").replaceAll("&quot;","\"").replaceAll("&apos;","'");<br />
if(XML.indexOf("<")>=0) out.print(XML);<br />
else {<br />
   java.io.BufferedOutputStream O = new java.io.BufferedOutputStream(response.getOutputStream());<br />
   O.write(javax.xml.bind.DatatypeConverter.parseBase64Binary(XML)); O.flush(); O.close();<br />
   }
   %><br /><br />
</tt>

<b>PHP</b><br /> 
<tt>
&lt;?php<br /> 
header("Content-Type: application/vnd.ms-excel; charset=utf-8");<br />
header("Content-Disposition: attachment; filename=\"" . $_REQUEST["ExportName"] . "." . $_REQUEST["ExportFormat"] . "\"");<br />
header("Cache-Control: max-age=1; must-revalidate");<br />
$XML = get_magic_quotes_gpc() ? stripslashes($_REQUEST["Data"]) : $_REQUEST["Data"];<br />
if(strpos($XML,"<")===false || strpos($XML,"&lt;")===false) echo(base64_decode($XML));<br />
else echo html_entity_decode($XML); ?><br /><br />
</tt>

<i>Any other language can generate the export similarly.</i><br />
<br />

<!-----------------------------------------------------------------------  Server export  ------------------------------------------------->
<a name="Server"></a>
<h2>Server export</h2>

To server is sent just actual grid configuration – sorting, grouping, filters, search and column width, positions and visibility.<br /> 
In "custom" parameter "<b>ExportFormat</b>" is sent chosen file extension "xlsx", "xls" or "csv".<br />
In "custom" parameter "<b>ExportName</b>" is sent chosen file name.<br />
In "custom" parameter "<b>ExportType</b>" is sent chosen <a href="#CfgExportType">ExportType</a> flags.<br />
For Export_Type="Settings", "Cols" or "Hidden", the rows and column are marked as visible if they were checked in export menu.<br />
<br />
It is possible to upload also other data from client like changes, set <tt>Export_Type="Settings,Changes"</tt>.<br />
The configuration is sent as standard TreeGrid XML in <a href="DataCommunication.htm#xxx_Data">Data</a> attribute.<br />
Server must generate the report from data on server by itself and return report to client.<br />
Use this way for larger grid and/or for grids with server paging or server child paging.<br />
Use it also if you want to generate different then standard report or you want to generate report for another program then MS Excel.<br />
<br />

<!--------------------  XML structure of request for server export  ------------------------->
<a name=""></a>
<h3>XML structure of request for server export</h3>

Used as <b>request sent</b> to data source <b>Export</b> to get the exported grid when set <b>server side export</b> (<b><tt>Export_Type</b>="<b>Settings</b>"</tt>).<br />
It contains session identification and grid configuration to sort, group, filter and search exported data on server.<br /> 
It contains also columns settings - width, position and visibility.<br /><br />

<tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">Grid</b>></tt><br />
  <div class="L1">
  <tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">IO</b></tt> <i>... attributes with request settings ...</i> <tt style="font-size:150%;color:red;">/></tt> (<a href="DataCommunication.htm#IOSession">Session</a> attribute) <br />
  <span style="float:left;">
  <tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">Cfg</b></tt> <i>... attributes with grid settings read from cookies ...</i> <tt style="font-size:150%;color:red;">/></tt>
  </span>
    <div style="float:left;">
    (HiddenRows, Sort, Group, ReSort, ReCalc, TimeZone attributes)<br />
    (SearchAction, SearchExpression, SearchType, SearchMethod, SearchDefs, SearchCols attributes)<br />
  	(Focused, FocusedCol, FocusedPos attributes)<br />
    (PrintPageBreaks, PrintRows, PrintExpanded, PrintFiltered)<br />
    </div>
  <div style="clear:both;"><tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">Filter</b>></tt> (list of filters)</div>
    <div class="L1">
    <tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">I</b></tt> <i>... row and cell attributes ...</i> <tt style="font-size:150%;color:red;">/></tt> (<b>id</b> attribute, cell <b>values</b> and cell <b>Filter</b> attributes)<br />
    <i>... More tags &lt;I> if more filters are in grid ...</i><br />
    </div>
  <tt style="font-size:150%;color:red;">&lt;/<b style="color:blue;">Filter</b>></tt><br /><br />

  <tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">LeftCols</b>></tt><br />
    <div class="L1">
    <tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">C</b></tt> <tt><b style="color:green;">Name</b>='<i>column name</i>' Width='...' Visible='0/1'</tt> <tt style="font-size:150%;color:red;">/></tt><br />
    <i>... more tags &lt;C> for other columns ...</i><br />
    </div>
  <tt style="font-size:150%;color:red;">&lt;/<b style="color:blue;">LeftCols</b>></tt><br />
  
  <tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">Cols</b>></tt><br />
    <div class="L1">
    <tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">C</b></tt> <tt><b style="color:green;">Name</b>='<i>column name</i>' Width='...' Visible='0/1'</tt> <tt style="font-size:150%;color:red;">/></tt><br />
    <i>... more tags &lt;C> for other columns ...</i><br />
    </div>
  <tt style="font-size:150%;color:red;">&lt;/<b style="color:blue;">Cols</b>></tt><br />

  <tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">RightCols</b>></tt><br />
    <div class="L1">
    <tt style="font-size:150%;color:red;">&lt;<b style="color:blue;">C</b></tt> <tt><b style="color:green;">Name</b>='<i>column name</i>' Width='...' Visible='0/1'</tt> <tt style="font-size:150%;color:red;">/></tt><br />
    <i>... more tags &lt;C> for other columns ...</i><br />
    </div>
  <tt style="font-size:150%;color:red;">&lt;/<b style="color:blue;">RightCols</b>></tt><br />
  </div><br />
  
<tt style="font-size:150%;color:red;">&lt;/<b style="color:blue;">Grid</b>></tt>  


</div>
</body>	
</html> 